package cn.wechat.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.wechat.pojo.user.Goods;
import cn.wechat.pojo.user.Type;
import cn.wechat.service.type.TypeService;

@Controller
@RequestMapping(value="/type")
public class TypeController {
	@Resource(name="typeService")
	public TypeService typeService;
	
	/**
	 * 查询分类
	 * 将数据放到all.html
	 * @param model
	 * @param tname
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/type.html")
	public String type(Model model,@RequestParam(value="tname",required=false) String tname) throws Exception{
		List<Type> type=null;
		if(tname==null){
			tname="";
		}
		type=typeService.getTypeName(tname);
		model.addAttribute("type",type);
		model.addAttribute("tname",tname);
		return "type";
		
	}


}
